Image management method, apparatus, and system, and terminal device

ABSTRACT

An image management method includes: after a video stream sent by a camera is obtained, recognizing a face image in the video stream through face recognition; comparing the image with a face image that is in an area in which the camera is located in a database; and if the comparison fails, expanding the area in which the camera is located around, and then comparing the face image with face images in an area obtained after the area in which the camera is located is expanded. .

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of International Application No.PCT/CN2021/088806, filed on Apr. 21, 2021, which claims priority toChinese Patent Application No. 202010819992.6, filed on Aug. 14, 2020.Both of the aforementioned applications are hereby incorporated byreference in their entireties.

FIELD

The present application relates to the field of image management, and inparticular, to an image management method, apparatus, and system, and aterminal device.

BACKGROUND

In the security field, a face image can be converted, by using a deepneural network, into a machine-recognizable vector for representation.Then a similarity degree of two face images is calculated based on anangle between vectors of the two face images. Based on this technology,a large quantity of face comparison—based applications are generated,such as a face recognition turnstile and face recognition alertdeployment. However, because of complexity of face images, face vectordimensions obtained through deep neural network conversion are usuallyfrom 128 to 512. High dimensionality of vectors causes high computingoverheads for face image comparison, which makes it difficult to use thetechnology in a large-scale face recognition application.

In order to reduce costs of high-dimensional vector comparison, an imagemanagement technology is used in the security field that applies facecomparison. A specific implementation process is as follows. Facefeatures of a large quantity of face images are extracted, clusteringbased on the face features of the face images is performed, and thenclustered face images are grouped according to natural persons, toobtain a face feature set of face images of each natural person. Whenface recognition is performed, a face feature of an obtained face imageis compared with the face feature set of the face images of each naturalperson. A natural person to which the obtained face image belongs isdetermined based on a similarity degree of comparison.

In the current technology, because a large quantity of face feature setsof natural person face images are stored in a database, high computingoverheads are incurred in a process of obtaining a face featuresimilarity degree by using this method.

SUMMARY

To resolve the foregoing problem, embodiments of this applicationprovide an image management method, apparatus, and system, and aterminal device.

According to a first aspect, this application provides an imagemanagement method. The method includes: receiving image data sent by afirst camera, where the image data includes at least one face image, andthe at least one face image includes a first face image; obtaining thefirst face image in the image data; comparing the first face image witha face image in a first area in a database, where the database is adatabase storing face images in each area, and the first area is an areain which at least one camera including the first camera is located; whenthe face image in the first area in the database does not include a faceimage of a photographed person corresponding to the first face image,comparing the first face image with face images in a second area in thedatabase, where the second area is an area obtained by expanding thefirst area around, the second area is an area in which a plurality ofcameras including the first camera are located, and a quantity ofcameras in the second area is greater than a quantity of cameras in thefirst area; and when the face images in the second area in the databaseinclude a face image of the photographed person corresponding to thefirst face image, clustering the first face image and the face image ofthe photographed person corresponding to the first face image.

In this implementation, after a face image of a photographed personincluded in image data captured by a camera is obtained, the image iscompared with a face image that is in an area in which the camera islocated in a database. If the comparison fails, the area in which thecamera is located is expanded around, and then the face image iscompared with face images in an area expanded based on the area in whichthe camera is located. By gradually expanding a comparison area, a largequantity of resources and a large amount of time consumed by directlycomparing the face image with face images in an entire database in thecurrent technology can be avoided.

In a specific implementation process, an area to be monitored and acamera location in the monitored area are first determined. Themonitored area is divided into a plurality of subareas, and a storagespace of a memory is divided into a corresponding quantity ofsub-storage spaces that are used as databases. Each subarea correspondsto one database, so that face images captured by all cameras in eachsubarea are compared with face images stored in a correspondingdatabase. When the face images stored in the corresponding database donot include a face image of a photographed person corresponding to aface image captured by the camera, the comparison database is expanded,to compare face images stored in databases corresponding to severalsubareas around the subarea with the obtained face image. Compared withthe manner of directly comparing a face image with all data in thedatabase in the current technology, the manner of gradually expandingthe comparison area significantly reduces a quantity of comparisontimes. In addition, a probability of face similarity in a small area isfar less than that in a large area. Therefore, interference caused bysimilar faces is further avoided in this application, thereby improvingclustering precision.

In an implementation, the method further includes: when a memory clarityvalue of the photographed person corresponding to the first face imageis less than a specified threshold, deleting all face images that are ofthe photographed person corresponding to the first face image and thatare in the second area in the database, where the memory clarity valueindicates a frequency at which the photographed person corresponding tothe first face image appears in the second area.

In this implementation, a memory clarity value f_(u) of eachphotographed person is compared with the specified threshold. A faceimage of the photographed person with a memory clarity value f_(u) lessthan the specified threshold in the database is deleted, to ensure thata face image of a person that frequently appears in a corresponding areais stored in a limited storage space of the memory.

In an implementation, the comparing the first face image with faceimages in a second area in the database includes: comparing the firstface image preferentially with a face image of a photographed personwith a high memory clarity value in the second area in the database, andthen comparing the first face image with a face image of a photographedperson with a low memory clarity value.

In this implementation, face images of all photographed persons storedin the memory are sorted based on memory clarity values f_(u), and thedatabase is updated based on a result obtained by sorting, so that in aprocess of face image comparison, the face image of the photographedperson with the high memory clarity value f_(u) is preferentiallycompared with the obtained face image. Because the photographed personwith the high memory clarity value f_(u) appears more frequently, and iscompared more frequently, comparison is performed in descending order ofthe memory clarity values f_(u), so that a quantity of comparison timesis effectively reduced.

In an implementation, after the obtaining the face image in the imagedata, the method further includes: obtaining a timestamp at which thefirst face image in the image data appears in the image data; and themethod further includes: calculating, based on the timestamp of thefirst face image and a quantity of face images that are of thephotographed person corresponding to the first face image and that arein the second area in the database, the memory clarity value of thephotographed person corresponding to the first face image.

In this implementation, the memory clarity value fu of the face image ofeach photographed person is obtained, to ensure that the face image ofthe person that frequently appears in the corresponding area is storedin the limited storage space of the memory.

In an implementation, the memory clarity value includes a long-termmemory value and/or a short-term memory value. The long-term memoryvalue is determined based on the quantity of face images that are of thephotographed person corresponding to the first face image and that arein the second area in the database, and the short-term memory value isdetermined based on the timestamp of the recently stored first faceimage.

In this implementation, the long-term memory means that a face image ofa person that frequently appears in the area is cached by the memory 30for a long time. The long-term memory is characterized in that a higherappearance frequency indicates a longer cache time. The short-termmemory means that a face image of a person that appears in the area fora short period of time is cached by the memory 30 for a short period oftime. The short-term memory is characterized by caching face images ofall people that appear in the area for a short period of time.

In an implementation, a calculation method of the memory clarity valueis specifically:

${f_{u} = {e^{\frac{T}{\rho s}} + {\lambda e^{\frac{T - t}{s}}}}},$

where f represents the memory clarity value, u represents a photographedperson, ρ represents a quantity of face images of the photographedperson u in the second area in the database, s represents a forgettingspeed, T represents a current moment, t represents a timestamp of arecently stored face image of the photographed person u, λ represents anadjustment parameter, the first e on the right represents a long-termmemory value, and the second e on the right represents a short-termmemory value.

In an implementation, the comparing the first face image with a faceimage in a first area in a database includes: converting the first faceimage into a first vector, where the first vector is a software programrecognizable vector; and comparing the first vector with a second vectorof each face image in the first area in the database, where the secondvector is a vector obtained by converting each face image in the firstarea in the database.

In an implementation, the method further includes: when the face imagesin the second area in the database do not include a face image of thephotographed person corresponding to the first face image, comparing theface image with face images in a national identity card face imagelibrary.

In an implementation, the second area in the database further includesidentity information of the photographed person corresponding to thefirst face image; and the method further includes: displaying theidentity information of the photographed person corresponding to thefirst face image on a display screen.

In this implementation, after the identity information of thephotographed person corresponding to the obtained face image isdetermined, the identity information of the photographed person isdisplayed on the display screen, so that management personnel determine,based on the identity information, whether the photographed personshould appear in a current area. If the photographed person is notsupposed to be in the area, the management personnel take measures suchas dissuasion or closing a door of a building to perform management andcontrol.

According to a second aspect, an embodiment of this application furtherprovides an image management server, including at least one processor,where the processor is used to execute instructions stored in a memory,so that a terminal performs the method that may be implemented in theimplementations of the first aspect.

According to a third aspect, an embodiment of this application furtherprovides an image management apparatus. The apparatus includes: atransceiver unit, configured to receive image data sent by a firstcamera, where the image data includes at least one face image, and theat least one face image includes a first face image; a recognition unit,configured to obtain the first face image in the image data; and aprocessing unit, configured to compare the first face image with a faceimage in a first area in a database, where the database is a databasestoring face images in each area, and the first area is an area in whichat least one camera including the first camera is located. When the faceimage in the first area in the database does not include a face image ofa photographed person corresponding to the first face image, the firstface image is compared with face images in a second area in thedatabase, where the second area is an area obtained by expanding thefirst area around, the second area is an area in which a plurality ofcameras including the first camera are located, and a quantity ofcameras in the second area is greater than a quantity of cameras in thefirst area. When the face images in the second area in the databaseinclude a face image of the photographed person corresponding to thefirst face image, clustering is performed on the first face image andthe face image of the photographed person corresponding to the firstface image.

In an implementation, the processing unit is further configured to, whena memory clarity value of the photographed person corresponding to thefirst face image is less than a specified threshold, delete all faceimages that are of the photographed person corresponding to the firstface image and that are in the second area in the database, where thememory clarity value indicates a frequency at which the photographedperson corresponding to the first face image appears in the second area.

In an implementation, the processing unit is specifically configured tocompare the first face image preferentially with a face image of aphotographed person with a high memory clarity value in the second areain the database, and then compare the first face image with a face imageof a photographed person with a low memory clarity value.

In an implementation, the transceiver unit is further configured toobtain a timestamp at which the first face image in the image dataappears in the image data; and the processing unit is further configuredto calculate, based on the timestamp of the first face image and thequantity of face images that are of the photographed personcorresponding to the first face image and that are in the second area inthe database, the memory clarity value of the photographed personcorresponding to the first face image.

In an implementation, the memory clarity value includes a long-termmemory value and/or a short-term memory value. The long-term memoryvalue is determined based on the quantity of face images that are of thephotographed person corresponding to the first face image and that arein the second area in the database, and the short-term memory value isdetermined based on the timestamp of the recently stored first faceimage.

In an implementation, the second area in the database further includesidentity information of the photographed person corresponding to thefirst face image; and the processing unit is further configured todisplay the identity information of the photographed personcorresponding to the first face image on a display screen.

According to a fourth aspect, an embodiment of this application furtherprovides a terminal device, configured to perform the method that may beimplemented in the implementations of the first aspect.

According to a fifth aspect, an embodiment of this application furtherprovides a computer-readable storage medium, where the computer-readablestorage medium stores a computer program, and when the computer programis executed in a computer, the computer is enabled to perform the methodthat may be implemented in the implementations of the first aspect.

According to a sixth aspect, an embodiment of this application furtherprovides a computing device. The device includes a memory and aprocessor, where the memory stores executable code, and when executingthe executable code, the processor implements the method that may beimplemented in the implementations of the first aspect.

According to a seventh aspect, an embodiment of this application furtherprovides an image management system, including at least one camera, amemory, and a processor configured to perform the method that may beimplemented in the implementations of the first aspect.

BRIEF DESCRIPTION OF DRAWINGS

The following briefly describes the accompanying drawings that are usedin the descriptions of the embodiments or the current technology.

FIG. 1 is a schematic diagram of a system architecture for implementingclustering according to an embodiment of this application;

FIG. 2 is a schematic diagram of division of a determined area accordingto an embodiment of this application;

FIG. 3 is a flowchart of image management according to an embodiment ofthis application;

FIG. 4 is a framework of image management according to an embodiment ofthis application;

FIG. 5 is a schematic diagram of a scenario in which a face image iscaptured in an area R_(1,1) according to an embodiment of thisapplication;

FIG. 6 is a schematic diagram of a curve change of long-term memoryaccording to an embodiment of this application;

FIG. 7 is a schematic diagram of a structure of a terminal deviceaccording to an embodiment of this application; and

FIG. 8 is a schematic diagram of a structure of an image managementapparatus according to an embodiment of this application.

DETAILED DESCRIPTION

To implement a clustering method according to an aspect provided in thisapplication, related hardware devices may be classified into threetypes, including a remote device, a processing device, and a storagedevice.

The remote device is a device with a camera function, for example, acamera, a face recognition payment device, or a security check device.In this application, a main function of the remote device is tophotograph a specified area, generate a video stream (or an image),store the generated video stream in a memory carried in the remotedevice, and then periodically send the generated video stream to theprocessing device, or send the generated video stream to the processingdevice in real time by using a communications unit carried in the remotedevice. In embodiments of the present application, a video stream and animage are collectively referred to as image data. The following uses thevideo stream as an example for description.

According to an application scenario, the remote device further includessome auxiliary apparatuses. For example, when the remote device is asubway security check device, the remote device further includes a gateapparatus that controls, by receiving an “on signal” or an “off signal”sent by the processing device, a gate in the gate apparatus to belowered or folded.

The processing device is a device with a computing function, forexample, a central processing unit (CPU) or a computer, or may even be acloud server. In this application, the processing device is mainlyconfigured to: extract a face image in a video stream by receiving thevideo stream, compare the face image with an existing face image,determine identity information of a photographed person corresponding tothe face image in the video stream, and cluster the face image in thevideo stream.

The storage device is used as a database for performing face imagecomparison by the processing device, and has a storage function. Thestorage device may be various memories, cloud servers, or the like. Inthis application, the storage device is configured to store data such asface images of each photographed person, or a face feature set of eachphotographed person, or a human face feature set, so that the processingdevice performs face feature comparison.

In addition, according to an implementation scenario of the clusteringmethod provided in this application, one or more of the remote device,the processing device, and the storage device may be selected forcombination. A specific classification is as follows.

1. In scenarios such as clock-in/out in an enterprise and face unlock,because a quantity of users in units such as a residential area or theenterprise is limited, the storage device does not need to store muchdata. Therefore, the remote device, the processing device, and thestorage device can be combined to exist as a whole. Such devices includea face recognition time clock, a mobile phone, a tablet, and the like.

2. In scenarios such as security check and surveillance, because a largequantity of remote devices are required and need to be distributed indifferent areas, the remote devices can exist independently. A remoteprocessing device and the storage device can be combined, or separatedfrom each other. Such devices include a residential access controldevice, devices that constitute an enterprise monitoring system, and thelike.

3. In a face recognition payment scenario, because security andconfidentiality are considered, the processing device and the remotedevice need to be combined to exist as a whole, to avoid a securityproblem caused by transmission of a face image that the remote deviceobtains to another processing device. In addition, the storage deviceneeds to exist independently, to avoid unauthorized tampering with datastored in the database incurred by placing the storage device togetherwith the processing device and the remote device. Such devices includedevices that constitute the face recognition payment device.

FIG. 1 is a schematic diagram of a system architecture for implementingclustering according to an embodiment of this application. As shown inFIG. 1 , the system includes a plurality of cameras 10, a user sidecontrolled terminal device 20, and a memory 30. The terminal device 20includes the memory 30. The terminal device 20 may be a computer, anotebook computer, a smart phone, or the like.

After installing the cameras 10 at key locations such as an intersectionin each area, a doorway, or a corridor lamp, a technician reports aninstallation location of each camera 10 to the terminal device 20, orthe terminal device 20 determines the location of each camera 10 basedon a positioning unit in each camera 10.

In a monitoring process, the terminal device 20 determines an area to bemonitored and a database in the memory 30, and constructs aspatial—temporal memory database, to be specific, divides the monitoredarea into a plurality of subareas. In addition, the terminal device 20also divides a storage space of the memory 30 into a plurality ofsub-storage spaces, and uses the sub-storage spaces as databases. Theneach subarea is associated with each database, so that a face imagecaptured by the camera 10 in each subarea is compared with a face imagestored in the associated database, and the face image captured by thecamera 10 is stored.

In addition, the terminal device 20 groups N adjacent subareas into asecond-level area, and correspondingly, groups N associated databasesinto a second-level database, so that a plurality of second-level areasare formed in the monitored area and a corresponding quantity ofsecond-level databases are formed in the memory 30. By analogy, theterminal device 20 sequentially forms a larger area by grouping aprevious-level area and a plurality of subareas around theprevious-level area, and also forms a larger database by grouping aplurality of corresponding associated databases.

For example, as shown in FIG. 2 , after determining an area R to bemonitored, the terminal device 20 divides the area R into 16 subareas,which are R_(1,1), R_(1,2), R_(1,3), R_(1,4), . . . , and R_(1,16). ForR_(1,1), three adjacent subareas R_(1,2), R_(1,5), and R_(1,6) aregrouped together with R_(1,1) to form a second-level area R_(2,1); fivesubareas R_(1,3), R_(1,7), R_(1,9), R_(1,10), and R_(1,11) around thesecond-level area R_(2,1) are grouped together with R_(2,1) to form athird-level area R_(3,1); seven subareas R_(1,4), R_(1,8), R_(1,12),R_(1,13), R_(1,14), R_(1,15), and R_(1,16) around the third-level areaR_(3,1) are grouped together with R_(3,1) to form a fourth-level areaR_(4,1) (that is, the area R).

Similarly, the storage space of the memory 30 is divided into 16sub-storage spaces that are used as 16 databases, which are K_(1,1),K_(1,2), K_(1,3), K_(1,4), . . . , and K_(1,16). Then, based on thecomposition of the second-level area, databases corresponding to thesubareas of the second-level area constitute a second-level databaseK_(2,n), and by analogy, a third-level database K_(3,n) and afourth-level database K_(4,n) are sequentially constructed.

For the memory 30, when the memory 30 is being initialized, face featuresets and/or face images of a specific quantity of photographed personsand identity information of the photographed persons, such as names,genders, companies, and home addresses, may be input in the storagespace of the memory 30 in advance. Alternatively, no face feature setand/or face image of any photographed person is input in advance. Ifface feature sets of a specific quantity of photographed persons havebeen input in the memory 30 in advance, when a plurality of databasesare obtained by division, in a possible implementation, based on areasin which each photographed person frequently appears, the face featuresets of the photographed persons input in advance are storedrespectively in databases corresponding to the areas in which thephotographed persons frequently appear. In another possibleimplementation, the face feature sets of the photographed persons inputin advance are directly stored in the databases. If no face feature setof any photographed person is input in advance in the memory 30, thereis no face feature set of any photographed person in each database.

In addition, if the memory 30 is used as an internal storage,persistence processing does not need to be performed when a face imageis subsequently stored. If the memory 30 is used as an external storage,when face image comparison is performed, the terminal device 20 invokes,from the memory 30 to an internal storage, a face image in a databasecorresponding to an area in which the face image to be compared islocated, to perform face image comparison. When the face image issubsequently stored, because the face image is initially cached in theinternal storage, persistence processing is required, and the face imagestored in the internal storage is stored in the memory 30.

In a flowchart shown in FIG. 3 and a schematic diagram of anarchitecture shown in FIG. 4 , a specific implementation process inwhich the terminal device 20 performs face image clustering afterconstructing the spatial—temporal memory database is as follows.

S301: Receive a video stream sent by at least one camera 10.

Specifically, when sending a video stream to the terminal device 20,each camera 10 carries identification information of camera 10 in thevideo stream, so that after receiving the video stream, the terminaldevice 20 determines, based on the identification information, a camera10 that sends the received video stream. Further, a subarea in which thecamera 10 is located is determined.

S302: Obtain a face image in the video stream and a timestamp at whichthe face image appears in the video stream.

Specifically, the terminal device 20 performs face recognition on thevideo stream received in real time by using a face recognitiontechnology, to recognize the face image that appears in the videostream. When the terminal device 20 recognizes a face in the videostream, the terminal device 20 extracts a face image of the face fromthe video stream, and records a timestamp at which the face imageappears in the video stream, to subsequently calculate a memory clarityvalue of each photographed person.

The face recognition technology is a biological feature recognitiontechnology, and distinguishes an organism (usually, a human) based on abiological feature of the organism. The face recognition technologyfirst determines, based on face features of a human, whether there is aface in an input face image or an input video stream. If there is aface, a position and size of each face and position information of eachmain face organ are further provided to obtain a face image. In thisapplication, the face recognition technology may be any one of existingface recognition based on a geometric feature, face recognition based oneigenface principal component analysis (PCA), face recognition based ona neural network, face recognition based on elastic bunch graphmatching, face recognition based on a line segment Hausdorff distance(LHD), and face recognition based on a support vector machine (SVM).

Optionally, the process implemented in S302 may be executed by thecamera 10 that sends the video stream. In this case, in S301, the camera10 only needs to send the face image and the timestamp at which the faceimage appears in the video stream to the terminal device 20, therebygreatly reducing a data amount that each camera 10 needs to send.

S303: Obtain a face feature of the face image based on the face image.

For example, after obtaining the face image, the terminal device 20performs processing on the face image, such as removing noises andsearching for key points (for example, a position of a corner of an eye,a position of a nose, contour points of a face). After the processing,the processed face image is input to a deep convolutional network, andis converted into and represented as a vector (128, 256, 512, or anotherdimension).

After the vector corresponding to the face image is obtained, based on aprinciple that a distance between vectors corresponding to face imagesof a same photographed person is small and a distance between vectorscorresponding to face images of different photographed persons is large,the following applications may be implemented.

1. Face identification: To detect whether a face image A and a faceimage B belong to a same person, only a distance between vectorscorresponding to the two face images needs to be calculated and anappropriate threshold is set. Then, it is determined whether thedistance between the two vectors is greater than the threshold. If thedistance is greater than the threshold, it indicates that the face imageA and the face image B do not belong to a same person. If the distanceis not greater than the threshold, it indicates that the face image Aand the face image B belong to a same person.

2. Face recognition: When a face image A is given, a face imagecorresponding to a vector whose distance is closest to a vectorcorresponding to the face image A is searched for in a database, and isused as a recognition result.

3. Image management (face clustering): Cluster faces in a database. Forexample, by using a k-means clustering algorithm (K-Means), K faceimages are randomly selected as an initial clustering center. Then, adistance between a vector corresponding to each face image and a vectorcorresponding to each face image in the clustering center is calculated.Each face image is allocated to a nearest face image in the clusteringcenter.

S304: Compare the face feature of the obtained face image with adatabase corresponding to an activity area. For example, an eigenvectorof the obtained face image is compared with an eigenvector of a face inthe database. A face eigenvector used for comparison may be prestored inthe database.

S305: Determine whether there are face images of a same photographedperson; and if no, perform S306; or if yes, perform S307.

For example, as shown in FIG. 5 , after the terminal device 20determines, based on the identification information of the camera 10carried in the video stream, that the video stream is sent by a cameraC1, the terminal device 20 determines, based on preset locationinformation, that a subarea in which the camera C1 is located isR_(1,1), that is, an activity area of the photographer personcorresponding to the face image. Then a database K_(1,1) correspondingto the subarea R_(1,1) is determined.

In the description about the memory 30, it has been mentioned that whenthe memory 30 is being initialized, there are two cases: One is thatface feature sets and/or face images of a specific quantity ofphotographed persons are input in advance; the other one is that no facefeature set and/or face image of any photographed person is input inadvance. For the first case, after determining the database K_(1,1), theterminal device 20 calculates a distance between the obtained vectorcorresponding to the face image in S303 and each vector of thephotographed person stored in the database K_(1,1). Then a minimumdistance value in distance values between two vectors is compared withthe threshold. If the minimum distance value is greater than thethreshold, it indicates that, in the database K_(1,1), there is no facefeature set and/or face image of the photographed person correspondingto the face image obtained in S302. Then S306 is performed. If theminimum distance value is not greater than the threshold, it indicatesthat, in the database K_(1,1), there are face feature sets and/or faceimages of the photographed person corresponding to the face imageobtained in S302. Further, the identity information of the photographedperson corresponding to the face image obtained in S302 is determined.Then S307 is performed.

If only face images are stored in each database, when comparing the faceimages, the terminal device 20 calculates, based on all face images of asame photographed person in the database, a corresponding vector of theface feature of the photographed person, and then performs comparison.

For example, in the monitoring scenario, after the terminal devicedetermines the identity information of the photographed personcorresponding to the face image obtained in S302, the identityinformation of the photographed person is displayed on a display screen,so that management personnel determine, based on the identityinformation, whether the photographed person should appear in thecurrent area R_(1,1). If the photographed person is not supposed to bein the area R_(1,1), the management personnel take measures such asdissuasion or closing a door of a building to perform management andcontrol.

For the second case, because no face image is stored in the storagespace, the terminal device 20 does not need to perform comparison, anddirectly performs S305.

S306: Expand the activity area of the photographed person correspondingto the obtained face image, that is, expand the activity area of thephotographed person from a first area to a second area.

For example, the terminal device 20 expands a possible activity area ofthe photographed person based on the activity area R_(1,1) of thephotographed person corresponding to the face image obtained in S302.The activity area of the photographed person is expanded to thesecond-level area R_(2,1) composed of the area R_(1,1) and the adjacentareas R_(1,2), R_(1,5), and R_(1,6) of the area R_(1,1). Then S304 isperformed. In this case, the “database corresponding to an activityarea” in S304 is expanded to a corresponding database that includes theareas R_(1,1), R_(1,2), R_(1,5), and R_(1,6) (that is, a second-leveldatabase K_(2,1)).

It should be noted that, because the area R_(2,1) includes the areaR_(1,1), and the area R_(1,1) have been compared in S304, there may betwo options when face images corresponding to the area R_(2,1) arecompared: (1) Comparison is performed only on areas that do not includethe area R_(1,1) in the area R_(2,1), that is, comparison is performedon the areas R_(1,2), R_(1,5), and R_(1,6). (2) Comparison is performedon all areas including the area R_(1,1) in the area R_(2,1), that is,comparison is performed on the areas R_(1,1), R_(1,2), R_(1,5), andR_(1,6). Both options provide a full comparison of the area R_(2,1). Ifthere is still no face feature set and/or face image of the photographedperson corresponding to the face image obtained in S302 in thesecond-level database K_(2,1), the possible activity area of thephotographed person is further expanded to the third-level area, thefourth-level area, and the like. The corresponding comparison databaseis expanded to the third-level database, the fourth-level database, andthe like, until the face feature sets and/or the face images of thephotographed person corresponding to the face image obtained in S302 canbe found.

If the face feature sets and/or the face images of the photographedperson corresponding to the face image obtained in S302 cannot be foundin the memory 30, the terminal device 20 may send the face imageobtained in S302 to a national identity card face image library forcomparison, to determine the identity information of the photographedperson corresponding to the face image obtained in S302.

S307: Perform clustering management on the obtained face image.Clustering management is to classify different images of a same objectinto a same category. In this step (or a previous step), a first faceimage is recorded in the database. The recording herein may be storingthe first face image, or may be storing an eigenvalue of the first faceimage.

In this embodiment, after comparison, the face image (the first faceimage) in the video stream and a face image recorded in the database arefound to be face images of a same photographed person. Then clusteringis performed on the two images, that is, both images are marked as theimages of the photographed person. In a more specific implementation,the first face image (or the eigenvalue of the first face image, forexample, an eigenvector of the first face image) is stored in thedatabase in a category of a photographed person to which a same faceimage that is compared with the first face image and that is in thesecond area belongs, or the first face image is set near the face imageof the photographed person. Then persistence processing is performed.

Specifically, if there are face feature sets and/or face images of thephotographed person corresponding to the face image obtained in S302 inthe database K_(1,1), the face image obtained in S302 is assigned to acategory of a photographed person to which the face image belongs in thedatabase K_(1,1), and the face image is set near a face image stored inthe database K_(1,1) with a minimum vector distance value.

Specifically, if there are face feature sets and/or face images of thephotographed person corresponding to the face image obtained in S302 inthe second-level database K_(2,1), the face image obtained in S302 isassigned to a category of a photographed person to which the face imagebelongs in the database K_(1,1), and the face image is set near a faceimage stored in the database K_(2,1) with a minimum vector distancevalue. In addition, the face image obtained in S302 and the identityinformation of the photographed person corresponding to the face imageare stored in the database K_(1,1), so that when the camera C1subsequently captures a face image of the photographed person again, theidentity information of the photographed person can be confirmed in thedatabase K_(1,1). For the third-level area and the fourth-level area,the rule applies.

Persistence means storing data (for example, an object in an internalstorage) in a storage device (for example, a disk, a solid state drive,or a tape) that can be used for long-time storing. Main application ofpersistence is to store the object in the internal storage in adatabase, or store the object in a disk file, an XML data file, and thelike. In this application, after the face image is obtained, the faceimage is cached in the internal storage. After it is determined that acorresponding database stores the face feature sets and/or the faceimages of the photographed person corresponding to the obtained faceimage, the obtained face image is stored in the external storage, thememory 30.

S308: Calculate the memory clarity value of the face image of eachphotographed person, and update the database based on the memory clarityvalues.

For example, the database K_(1,1) is used as an example. When thedatabase K_(1,1) stores related information of the photographed personcorresponding to the face image obtained in S302, the terminal device 20calculates the memory clarity value of the photographed person based ona quantity of face images of the photographed person stored in thedatabase K_(1,1) and the timestamp of the recently stored face image ofthe photographed person. A specific calculation process is as follows:

$\begin{matrix}{f_{u} = {e^{\frac{T}{\rho s}} + {\lambda e^{\frac{T - t}{s}}}}} & (1)\end{matrix}$

In this formula, f represents a memory clarity value, u represents eachphotographed person, ρ represents a quantity of face images of thephotographed person u stored in the database corresponding to the areaR_(1,1), s represents a forgetting speed, T represents a current moment,t represents a time at which a recently stored face image of thephotographed person u appears in a video stream, and λ represents anadjustment parameter.

According to the formula (1), it can be learned that the first erepresents long-term memory, and the long-term memory means that a faceimage of a person that frequently appears in the area is cached by thememory 30 for a long time. The long-term memory is characterized in thata higher appearance frequency indicates a longer cache time. The seconde represents short-term memory. The short-term memory means that a faceimage of a person that appears in the area for a short period of time iscached by the memory 30 for a short period of time. The short-termmemory is characterized by caching face images of all people that appearin the area for a short period of time.

In addition, it can be learned from the formula that a larger quantity ρof face images of each photographed person indicates a higher long-termmemory value and a higher f_(u) value; and a closer time between thephotographed person's latest appearances in a corresponding areaindicates a higher short-term memory value and a higher fu value. Overtime, both the long-term and the short-term memory decay, and theshort-term memory decays faster than the long-term memory. For intuitiveunderstanding of a decaying process, reference is made to a functioncurve

$e^{\frac{T}{\rho s}}$

shown in FIG. 6 . The short-term memory can be considered as a specialcase of the long-term memory when t=0 and ρ=1.

After obtaining the memory clarity value f_(u) of the face image of eachphotographed person, the terminal device 20 first compares the memoryclarity value f_(u) of each photographed person with a specifiedthreshold. A face image of the photographed person with a memory clarityvalue f_(u) less than the specified threshold in the database isdeleted, to ensure that a face image of a person that frequently appearsin a corresponding area is stored in the limited storage space of thememory 30.

The terminal device 20 further sorts face images of all photographedpersons stored in the memory 30 based on memory clarity values f_(u),and the database is updated based on a result obtained by sorting, sothat in a process of face image comparison, a face image of thephotographed person with a high memory clarity value f_(u) ispreferentially compared with the obtained face image. Because thephotographed person with the high memory clarity value f_(u) appearsmore frequently, and is compared more frequently, comparison isperformed in descending order of the memory clarity values f_(u), sothat a quantity of comparison times is effectively reduced.

In this application, the terminal device 20 first determines the area tobe monitored and the camera location in the monitored area. Themonitored area is divided into the plurality of subareas, and thestorage space of the memory 30 is divided into the correspondingquantity of sub-storage spaces that are used as the databases. Eachsubarea corresponds to one database, so that face images captured by allcameras in each subarea are compared with face images stored in acorresponding database. When there is no face image of the photographedperson corresponding to the face image captured by the camera in theface images stored in the corresponding database, the terminal device 20expands the comparison database, to compare the face images stored inthe databases corresponding to several subareas around the subarea withthe obtained face image. Compared with the manner of directly comparinga face image with all data in the database in the current technology,the manner of gradually expanding the comparison area significantlyreduces a quantity of comparison times. In addition, a probability offace similarity in a small area is far less than that in a large area.Therefore, interference caused by similar faces is further avoided inthis application, thereby improving clustering precision.

In addition, in this application, when the face image in the videostream is obtained, the timestamp at which the face image appears in thevideo stream is further recorded. After the face image is stored in acorresponding database, the terminal device 20 calculates the memoryclarity value of each photographed person based on a quantity of faceimages of a same person stored in the database and the timestamp of therecently stored face image, deletes some face images of the photographedperson with a relatively low memory clarity value based on the memoryclarity values, to reduce a storage amount of the database, and finallysorts the face images of the photographed person based on the memoryclarity values. The face images of the photographed person with a largememory clarity value are preferentially compared with the obtained faceimage, thereby further reducing a quantity of comparison times.

FIG. 7 is a schematic diagram of a structure of a terminal deviceaccording to an embodiment of this application. The terminal device is,for example, a camera and a server. The terminal device 700 is shown inFIG. 7 . The terminal device 700 may be the terminal device 20, and mayinclude an input/output component 701, a processor 702, a memory 703, acommunications interface 704, and a bus 705. The processor 702, thememory 703, and the communications interface 704 in the terminal device700 may establish a communication connection by using the bus 705.

The input/output component 701 may be a display, a loudspeaker, amicrophone, or the like, and is configured to receive or sendinformation such as instructions or data. For example, when used as thedisplay, the input/output component 701 can display identity informationof a photographed person. When used as the loudspeaker, the input/outputcomponent 701 can issue a warning sound signal according to aninstruction.

The processor 702 may be a central processing unit (CPU). In theforegoing embodiment, a specific implementation process of clusteringface images described in FIG. 3 is all executed by the processor 702.

The memory 703 may include a volatile memory, such as a random-accessmemory (RAM); or the memory 703 may include a non-volatile memory, suchas a read-only memory (ROM), a flash memory, a hard disk drive (HDD), ora solid state drive (SSD); or the memory 703 may further include acombination of the foregoing types of memories. Data such as a videostream, a face image, and a database is stored in the memory 703. Inaddition, the memory 703 is further configured to store correspondingprogram instructions and the like that are executed by the processor 702to implement the image management method described in the foregoingembodiment.

For this embodiment of this application, the memory 703 may be thememory 30 described in FIG. 1 to FIG. 6 , or may include the memory 30described in FIG. 1 to FIG. 6 .

The communications interface 704 may be a communications unit such as aBluetooth module, a Wi-Fi module, or a P5 interface, and is configuredto receive or send information such as data and instructions, forexample, to receive a video stream in this embodiment of thisapplication.

FIG. 8 is a schematic diagram of a structure of an image managementapparatus according to an embodiment of this application. As shown inFIG. 8 , the apparatus 800 includes a transceiver unit 801, arecognition unit 802, and a processing unit 803.

The transceiver unit 801 is configured to receive a video stream sent bya first camera, where the video stream includes at least one face image,and the at least one face image includes a first face image.

The recognition unit 802 is configured to obtain the first face image inthe video stream.

The processing unit 803 is configured to compare the first face imagewith a face image in a first area in a database, where the database is adatabase storing face images in each area, and the first area is an areain which at least one camera including the first camera is located; whenthe face image in the first area in the database does not include a faceimage of a photographed person corresponding to the first face image,compare the first face image with face images in a second area in thedatabase, where the second area is an area obtained by expanding thefirst area around, the second area is an area in which a plurality ofcameras including the first camera are located, and a quantity ofcameras in the second area is greater than a quantity of cameras in thefirst area; and when the face images in the second area in the databaseinclude a face image of the photographed person corresponding to thefirst face image, cluster the first face image and the face image of thephotographed person corresponding to the first face image.

In a possible embodiment, the processing unit 803 is further configuredto, when a memory clarity value of the photographed person correspondingto the first face image is less than a specified threshold, delete allface images that are of the photographed person corresponding to thefirst face image and that are in the second area in the database, wherethe memory clarity value indicates a frequency at which the photographedperson corresponding to the first face image appears in the second area.

In a possible embodiment, the processing unit 803 is specificallyconfigured to compare the first face image preferentially with a faceimage of a photographed person with a high memory clarity value in thesecond area in the database, and then compare the first face image witha face image of a photographed person with a low memory clarity value.

In a possible embodiment, the transceiver unit 801 is further configuredto obtain a timestamp at which the first face image in the video streamappears in the video stream; and the processing unit 803 is furtherconfigured to calculate, based on the timestamp of the first face imageand a quantity of face images that are of the photographed personcorresponding to the first face image and that are in the second area inthe database, the memory clarity value of the photographed personcorresponding to the first face image.

In a possible embodiment, the memory clarity value includes a long-termmemory value and/or a short-term memory value. The long-term memoryvalue is determined based on the quantity of face images that are of thephotographed person corresponding to the first face image and that arein the second area in the database, and the short-term memory value isdetermined based on the timestamp of the recently stored first faceimage.

In a possible embodiment, the second area in the database furtherincludes identity information of the photographed person correspondingto the first face image; and the processing unit 803 is furtherconfigured to display the identity information of the photographedperson corresponding to the first face image on a display screen.

The present application provides a computer-readable storage medium,where the computer-readable storage medium stores a computer program,and when the computer program is executed on a computer, the computer isenabled to implement any one of the foregoing methods.

The present application provides a computing device, including a memoryand a processor, where the memory stores executable code, and whenexecuting the executable code, the processor implements any one of theforegoing methods.

A person of ordinary skill in the art may be aware that, in combinationwith the examples described in embodiments disclosed in thisspecification, units and algorithm steps may be implemented byelectronic hardware or a combination of computer software and electronichardware. Whether the functions are performed by hardware or softwaredepends on particular applications and design constraints of thetechnical solutions. A person skilled in the art may use differentmethods to implement the described functions for each particularapplication, but it should not be considered that the implementationgoes beyond the scope of the embodiments of this application.

In addition, aspects or features in embodiments of this application maybe implemented as a method, an apparatus, or a product that usesstandard programming and/or engineering technologies. The term “product”used in this application covers a computer program that can be accessedfrom any computer-readable device, carrier or medium. For example, thecomputer-readable medium may include but is not limited to a magneticstorage component (for example, a hard disk drive, a floppy disk, or amagnetic tape), an optical disc (for example, a compact disc (CD) or adigital versatile disc DVD)), a smart card, and a flash memory component(for example, an erasable programmable read-only memory (EPROM), a card,a stick, or a key drive). In addition, various storage media describedin this specification may represent one or more devices and/or othermachine-readable media that are configured to store information. Theterm “machine-readable media” may include but is not limited to radiochannels and various other media that can store, include, and/or carryinstructions and/or data.

In the foregoing embodiment, the image management apparatus 800 shown inFIG. 8 may be implemented in whole or in part by using software,hardware, firmware, or any combination thereof. When software is used toimplement the embodiments, all or some of the embodiments may beimplemented in a form of a computer program product. The computerprogram product includes one or more computer instructions. When thecomputer program instructions are loaded and executed on a computer, theprocedures or functions according to the embodiments of this applicationare all or partially generated. The computer may be a general purposecomputer, a dedicated computer, a computer network, or anotherprogrammable apparatus. The computer instructions may be stored in thecomputer-readable storage medium or may be transmitted from acomputer-readable storage medium to another computer-readable storagemedium. For example, the computer instructions may be transmitted from awebsite, computer, server, or data center to another website, computer,server, or data center in a wired (for example, a coaxial cable, anoptical fiber, or a digital subscriber line (DSL)) or wireless (forexample, infrared, radio, or microwave) manner. The computer-readablestorage medium may be any usable medium accessible by the computer, or adata storage device, such as a server or a data center, integrating oneor more usable media. The usable medium may be a magnetic medium (forexample, a floppy disk, a hard disk drive, or a magnetic tape), anoptical medium (for example, a DVD), a semiconductor medium (forexample, a solid state drive (SSD)), or the like.

It should be understood that sequence numbers of the foregoing processesdo not mean execution sequences in various embodiments of thisapplication. The execution sequences of the processes should bedetermined according to functions and internal logic of the processes,and should not be construed as any limitation on the implementationprocesses of the embodiments of this application.

It may be clearly understood by a person skilled in the art that, forthe purpose of convenient and brief description, for a detailed workingprocess of the foregoing system, apparatus, and unit, refer to acorresponding process in the foregoing method embodiments, and detailsare not described herein again.

In the several embodiments provided in this application, it should beunderstood that the disclosed system, apparatus, and method may beimplemented in other manners. For example, the foregoing apparatusembodiments are merely examples. For example, division of the units ismerely logical function division and may be other division during actualimplementation. For example, a plurality of units or components may becombined or integrated into another system, or some features may beignored or not performed. In addition, the displayed or discussed mutualcouplings or direct couplings or communication connections may beimplemented through some interfaces. The indirect couplings orcommunication connections between the apparatuses or units may beimplemented in electronic, mechanical, or other forms.

The units described as separate parts may or may not be physicallyseparate, and parts displayed as units may or may not be physical units,may be located in one position, or may be distributed on a plurality ofnetwork units. Some or all of the units may be selected depending onactual requirements to achieve the objectives of the solutions in theembodiments.

When the functions are implemented in the form of a software functionalunit and sold or used as an independent product, the functions may bestored in a computer-readable storage medium. Based on such anunderstanding, the technical solutions of the embodiments of thisapplication essentially, or the part contributing to the currenttechnology, or some of the technical solutions may be implemented in aform of a software product. The computer software product is stored in astorage medium, and includes several instructions for instructing acomputer device (which may be a personal computer, a server, or anaccess network device) to perform all or some of the steps of themethods described in embodiments of this application. The storage mediumincludes any medium that can store program code, such as a USB flashdrive, a removable hard disk, a read-only memory (ROM), a random accessmemory (RAM), a magnetic disk, or an optical disc.

The foregoing descriptions are merely specific implementations of thisapplication, but are not intended to limit the protection scope of thisapplication. Any variation or replacement readily figured out by aperson skilled in the art within the technical scope disclosed in thisapplication shall fall within the protection scope of this application.

1. An image management method, the method comprising: receiving image data sent by a first camera, the image data comprising at least one face image, and the at least one face image comprising a first face image; obtaining the first face image in the image data; comparing the first face image with a face image in a first area in a database, the database being a database storing face images in each area, and the first area being an area in which at least one camera comprising the first camera is located; based upon determining that the face image in the first area in the database does not comprise a face image of a photographed person corresponding to the first face image, comparing the first face image with face images in a second area in the database, the second area being an area obtained by expanding around the first area, the second area being an area in which a plurality of cameras comprising the first camera are located, and a quantity of cameras in the second area being greater than a quantity of cameras in the first area; and based upon determining that the face images in the second area in the database comprise a face image of the photographed person corresponding to the first face image, clustering the first face image and the face image of the photographed person corresponding to the first face image.
 2. The method according to claim 1, wherein the method further comprises: based upon determining that a memory clarity value of the photographed person corresponding to the first face image is less than a specified threshold, deleting all face images that are of the photographed person corresponding to the first face image and that are in the second area in the database, and wherein the memory clarity value indicates a frequency at which the photographed person corresponding to the first face image appears in the second area.
 3. The method according to claim 1, wherein the comparing the first face image with face images in the second area in the database comprises: comparing the first face image preferentially with a face image of the photographed person with a high memory clarity value in the second area in the database, and then comparing the first face image with a face image of the photographed person with a low memory clarity value.
 4. The method according to -claim 1, wherein after the obtaining the first face image in the image data, the method further comprises: obtaining a timestamp at which the first face image in the image data appears in the image data, and wherein the method further comprises: calculating, based on the timestamp of the first face image and a quantity of face images that are of the photographed person corresponding to the first face image and that are in the second area in the database, the memory clarity value of the photographed person corresponding to the first face image.
 5. The method according to claim 1, wherein a memory clarity value comprises a long-term memory value or a short-term memory value, the long-term memory value is determined based on the quantity of face images that are of the photographed person corresponding to the first face image and that are in the second area in the database, and the short-term memory value is determined based on the timestamp of the recently stored first face image.
 6. The method according to claim 1, wherein the method further comprises: based upon determining that the face images in the second area in the database do not comprise a face image of the photographed person corresponding to the first face image, comparing the face image with face images in a national identity card face image library.
 7. The method according to claim 1, wherein the database further comprises identity information of the photographed person corresponding to the first face image, and the method further comprises: displaying the identity information of the photographed person corresponding to the first face image on a display screen.
 8. A computing device, the computing device comprising: a memory storing computer executable instructions; and a processor connected to the memory and configured to execute the computer executable instructions to perform operations comprising: receiving image data sent by a first camera, the image data comprising at least one face image, and the at least one face image comprising a first face image; obtaining the first face image in the image data; comparing the first face image with a face image in a first area in a database, the database being a database storing face images in each area, and the first area being an area in which at least one camera comprising the first camera is located; based upon determining that the face image in the first area in the database does not comprise a face image of a photographed person corresponding to the first face image, comparing the first face image with face images in a second area in the database, the second area being an area obtained by expanding around the first area, the second area being an area in which a plurality of cameras comprising the first camera are located, and a quantity of cameras in the second area being greater than a quantity of cameras in the first area; and based upon determining that the face images in the second area in the database comprise a face image of the photographed person corresponding to the first face image, clustering the first face image and the face image of the photographed person corresponding to the first face image.
 9. The device according to claim 8, wherein the operations further comprise: based upon determining a memory clarity value of the photographed person corresponding to the first face image is less than a specified threshold, deleting all face images that are of the photographed person corresponding to the first face image and that are in the second area in the database, and wherein the memory clarity value indicates a frequency at which the photographed person corresponding to the first face image appears in the second area.
 10. The device according to claim 8, wherein the operation of comparing the first face image with face images in a second area in the database comprises: comparing the first face image preferentially with a face image of the photographed person with a high memory clarity value in the second area in the database, and then comparing the first face image with a face image of the photographed person with a low memory clarity value.
 11. The device according to claim 8, wherein after the operation of obtaining the first face image in the image data, the operations further comprise: obtaining a timestamp at which the first face image in the image data appears in the image data; and calculating, based on the timestamp of the first face image and a quantity of face images that are of the photographed person corresponding to the first face image and that are in the second area in the database, a memory clarity value of the photographed person corresponding to the first face image.
 12. The device according to claim 8, wherein a memory clarity value comprises a long-term memory value or a short-term memory value, the long-term memory value is determined based on a quantity of face images that are of the photographed person corresponding to the first face image and that are in the second area in the database, and the short-term memory value is determined based on a timestamp of the recently stored first face image.
 13. The device according to claim 8, wherein the operations further comprise: based upon determining that the face images in the second area in the database do not comprise a face image of the photographed person corresponding to the first face image, comparing the face image with face images in a national identity card face image library.
 14. The device according to claim 8, wherein the database further comprises identity information of the photographed person corresponding to the first face image, and the operations further comprise: displaying the identity information of the photographed person corresponding to the first face image on a display screen.
 15. A non-transitory computer-readable storage medium, the computer-readable storage medium storing a computer program, and the computer program being configured such that, when executed on a computer, the computer is enabled to implement a method comprising: receiving image data sent by a first camera, the image data comprising at least one face image, and the at least one face image comprising a first face image; obtaining the first face image in the image data; comparing the first face image with a face image in a first area in a database, the database being a database storing face images in each area, and the first area being an area in which at least one camera comprising the first camera is located; based upon determining that the face image in the first area in the database does not comprise a face image of a photographed person corresponding to the first face image, comparing the first face image with face images in a second area in the database, the second area being an area obtained by expanding around the first area, the second area being an area in which a plurality of cameras comprising the first camera are located, and a quantity of cameras in the second area being greater than a quantity of cameras in the first area; and based upon determining that the face images in the second area in the database comprise a face image of the photographed person corresponding to the first face image, clustering the first face image and the face image of the photographed person corresponding to the first face image.
 16. The non-transitory computer-readable storage medium according to claim 15, wherein the method further comprises: based upon determining that a memory clarity value of the photographed person corresponding to the first face image is less than a specified threshold, deleting all face images that are of the photographed person corresponding to the first face image and that are in the second area in the database, wherein the memory clarity value indicates a frequency at which the photographed person corresponding to the first face image appears in the second area.
 17. The non-transitory computer-readable storage medium according to claim 15, wherein the comparing the first face image with face images in a second area in the database comprises: comparing the first face image preferentially with a face image of the photographed person with a high memory clarity value in the second area in the database, and then comparing the first face image with a face image of the photographed person with a low memory clarity value.
 18. The non-transitory computer-readable storage medium according to claim 15, wherein after the obtaining the first face image in the image data, the method further comprises: obtaining a timestamp at which the first face image in the image data appears in the image data; and calculating, based on the timestamp of the first face image and a quantity of face images that are of the photographed person corresponding to the first face image and that are in the second area in the database, the memory clarity value of the photographed person corresponding to the first face image.
 19. The non-transitory computer-readable storage medium according to claim 15, wherein a memory clarity value comprises a long-term memory value or a short-term memory value, the long-term memory value is determined based on the quantity of face images that are of the photographed person corresponding to the first face image and that are in the second area in the database, and the short-term memory value is determined based on the timestamp of the recently stored first face image.
 20. The non-transitory computer-readable storage medium according to claim 15, wherein the method further comprises: based upon determining that the face images in the second area in the database do not comprise a face image of the photographed person corresponding to the first face image, comparing the face image with face images in a national identity card face image library. 